//
//  IManager+ServerControlReq.m
//  RocketProject
//
//  Created by chen jiedan on 13-9-29.
//  Copyright (c) 2013年 Rocket. All rights reserved.
//

#import "IManager+ServerControlReq.h"
#import "NetUrlDefines.h"
#import "RequestUtlity.h"
#import "FrameworkRelativeDefines.h"
#import "GloableEngineService.h"
#import "RCBaseServerDataModel.h"


@implementation IManager (ServerControlReq)

- (int64_t) requestUpdatePic:(NSString *)picID withState:(PicState)picState withDelegate:(id<IManagerDelegate>)delegate
{
    if (nil == picID ) {
        return kInvalidRequestId;
    }
    // 异步获取数据
    
    NSString *shopBduss = [[GloableEngineService sharedInstance] shopBduss];
    NSString *shopID = [[GloableEngineService sharedInstance] shopID];

    NSString *urlSuffix = [NSString stringWithFormat:kRCPicStateUpdatePrefix,shopBduss,shopID,picID,picState];
    
    NSString *url = [RequestUtlity getFormattedUrl:urlSuffix];
    KFLog(@"request url %@",url);
//    NSDictionary *userInfo = [[NSDictionary alloc] initWithObjects:[NSArray arrayWithObject:@"MerchantDetailJson"] forKeys:[NSArray arrayWithObject:@"FakeJson"]];
    return [[IDataProvider sharedInstance] asyncFetchDataWithUserInfo:url
                                                             userInfo:nil
                                                      withCachePolicy:IDataCachePolicyLocalFileAndNetwork
                                                   withDataParseClass:[RCBaseServerDataModel class]
                                                     withDataDelegate:delegate];
}


-(int64_t)requestUpdateComment:(NSString *)commentID withState:(CommentState)commentState withDelegate:(id<IManagerDelegate>)delegate
{
    if (nil == commentID ) {
        return kInvalidRequestId;
    }
    // 异步获取数据
    
    NSString *shopBduss = [[GloableEngineService sharedInstance] shopBduss];
    NSString *shopID = [[GloableEngineService sharedInstance] shopID];
    
    NSString *urlSuffix = [NSString stringWithFormat:kRCCommentStateUpdatePrefix,shopBduss,shopID,commentID,commentState];
    
    NSString *url = [RequestUtlity getFormattedUrl:urlSuffix];
    KFLog(@"request url %@",url);
    //    NSDictionary *userInfo = [[NSDictionary alloc] initWithObjects:[NSArray arrayWithObject:@"MerchantDetailJson"] forKeys:[NSArray arrayWithObject:@"FakeJson"]];
    return [[IDataProvider sharedInstance] asyncFetchDataWithUserInfo:url
                                                             userInfo:nil
                                                      withCachePolicy:IDataCachePolicyLocalFileAndNetwork
                                                   withDataParseClass:[RCBaseServerDataModel class]
                                                     withDataDelegate:delegate];
}

-(int64_t)requestUpdateImpressive:(NSString *)impressiveID withState:(ImpressiveState)impressiveState withDelegate:(id<IManagerDelegate>)delegate
{
    if (nil == impressiveID ) {
        return kInvalidRequestId;
    }
    // 异步获取数据
    
    NSString *shopBduss = [[GloableEngineService sharedInstance] shopBduss];
    NSString *shopID = [[GloableEngineService sharedInstance] shopID];
    
    NSString *urlSuffix = [NSString stringWithFormat:kRCImpressiveStateUpdatePrefix,shopBduss,shopID,impressiveID,impressiveState];
    
    NSString *url = [RequestUtlity getFormattedUrl:urlSuffix];
    KFLog(@"request url %@",url);
    //    NSDictionary *userInfo = [[NSDictionary alloc] initWithObjects:[NSArray arrayWithObject:@"MerchantDetailJson"] forKeys:[NSArray arrayWithObject:@"FakeJson"]];
    return [[IDataProvider sharedInstance] asyncFetchDataWithUserInfo:url
                                                             userInfo:nil
                                                      withCachePolicy:IDataCachePolicyLocalFileAndNetwork
                                                   withDataParseClass:[RCBaseServerDataModel class]
                                                     withDataDelegate:delegate];
}
@end
